GtkScrolledWindow: Factor out a constant
authorMatthias Clasen <mclasen@redhat.com>
Sat, 10 Jan 2015 02:12:00 +0000 (21:12 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 10 Jan 2015 02:15:06 +0000 (21:15 -0500)
Define INDICATOR_CLOSE_DISTANCE instead of hardcoding the same
number of pixels in 4 different places.

gtk/gtkscrolledwindow.c

index f4e85fd9905ecd6bfc330a8d09e9c83a6764936f..174f70938d1ac03559f0cb23f26475d29efccea8 100644 (file)
 #define INDICATOR_FADE_OUT_DELAY 2000
 #define INDICATOR_FADE_OUT_DURATION 1000
 #define INDICATOR_FADE_OUT_TIME 500
+#define INDICATOR_CLOSE_DISTANCE 50
 
 /* Scrolled off indication */
 #define UNDERSHOOT_SIZE 40
@@ -990,11 +991,11 @@ event_close_to_indicator (GtkScrolledWindow *sw,
     }
 
   if ((indicator == &priv->hindicator &&
-       y >= win_y - 50 &&
-       y < win_y + indicator_alloc.height + 50) ||
+       y >= win_y - INDICATOR_CLOSE_DISTANCE &&
+       y < win_y + indicator_alloc.height + INDICATOR_CLOSE_DISTANCE) ||
       (indicator == &priv->vindicator &&
-       x >= win_x - 50 &&
-       x < win_x + indicator_alloc.width + 50))
+       x >= win_x - INDICATOR_CLOSE_DISTANCE  &&
+       x < win_x + indicator_alloc.width + INDICATOR_CLOSE_DISTANCE))
     return TRUE;
 
   return FALSE;